<?php
$ssFilter = $this->_arrParam['ssFilter'];
$num_event_day = empty($this->_arrParam['event_day']) ? 0 : $this->_arrParam['event_day'][0]['mem_count'];
$num_member_day = empty($this->_arrParam['member_day']) ? 0 : $this->_arrParam['member_day'][0]['mem_count'];
$num_event_week = empty($this->_arrParam['events_week']) ? 0 : $this->_arrParam['events_week'][0]['mem_count'];
$num_member_week = empty($this->_arrParam['member_week']) ? 0 : $this->_arrParam['member_week'][0]['mem_count'];
$num_event_month = empty($this->_arrParam['events_month']) ? 0 : $this->_arrParam['events_month'][0]['mem_count'];
$num_member_month = empty($this->_arrParam['member_month']) ? 0 : $this->_arrParam['member_month'][0]['mem_count'];
$slkSelect[7] = 'Week';
$slkSelect[30] = 'Month';
$keywords = CHtml::textField('keywords', empty($ssFilter['keywords']) ? NULL : $ssFilter['keywords'], array('autocomplete' => 'off', 'placeholder' => 'Enter email', 'class' => 'form-control', 'style' => 'width:250px'));
$linkSearch = $this->createUrl('default/filters?type=search&key=1&mail=email');
$linkResetSearch = $this->createUrl('default/filters?type=search&key=0&mail=email');
$buttonSearch = Chtml::button('Search', array('onclick' => "OnSubmitForm('" . $linkSearch . "')", 'name' => 'search-now', 'class' => 'btn blue', 'style' => 'margin:0px 10px 0px 0px'));
$buttonReset = CHtml::button('Clear', array('onclick' => "OnSubmitForm('" . $linkResetSearch . "')", 'class' => 'btn blue', 'style' => 'margin:0px 10px 0px 0px'));
$strSeach = $keywords . $buttonSearch . $buttonReset;
?>
<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">Modal title</h4>
            </div>
            <div class="modal-body">
                Widget settings form goes here
            </div>
            <div class="modal-footer">
                <button type="button" class="btn blue">Save changes</button>
                <button type="button" class="btn default" data-dismiss="modal">Close</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<!-- BEGIN PAGE HEADER-->
<div class="row">
    <div class="col-md-12">              
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="icon-home"></i>
                <a href="index">Home</a>
                <i class="icon-angle-right"></i>
            </li>
            <li><a href="#">Dashboard</a></li>
            <li class="pull-right">                
            </li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN DASHBOARD STATS -->
<div class="row">
    <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
        <div class="dashboard-stat blue">
            <div class="visual">
                <i class="icon-comments"></i>
            </div>
            <div class="details">
                <div class="number">
                    <table class='view_em'>
                        <tr><th>Sự kiện mới</th><td><?php echo $num_event_day ?></td></tr>
                        <tr><th>Thành viên mới</th><td><?php echo $num_member_day; ?></td></tr>
                    </table>                                        
                </div>
                <div class="desc">
                    Today
                </div>
            </div>
            <a class="more" href="<?php echo Yii::app()->createUrl('/Dashboard/default/index'); ?>">
                View more <i class="m-icon-swapright m-icon-white"></i>
            </a>
        </div>
    </div>
    <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
        <div class="dashboard-stat green">
            <div class="visual">
                <i class="icon-shopping-cart"></i>
            </div>
            <div class="details">
                <div class="number">
                    <table class='view_em'>
                        <tr><th>Sự kiện mới </th><td><?php echo $num_event_week ?></td></tr>
                        <tr><th>Thành viên mới</th><td><?php echo $num_member_week; ?></td></tr>
                    </table> 
                </div>
                <div class="desc">This Week</div>
            </div>
            <a class="more" href="<?php echo Yii::app()->createUrl('/Dashboard/default/week'); ?>">
                View more <i class="m-icon-swapright m-icon-white"></i>
            </a>
        </div>
    </div>
    <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
        <div class="dashboard-stat purple">
            <div class="visual">
                <i class="icon-globe"></i>
            </div>
            <div class="details">
                <div class="number">
                    <table class='view_em'>
                        <tr><th>Sự kiện mới</th><td><?php echo $num_event_month ?></td></tr>
                        <tr><th>Thành viên mới</th><td><?php echo $num_member_month; ?></td></tr>
                    </table> 
                </div>
                <div class="desc">This Month</div>
            </div>
            <a class="more" href="<?php echo Yii::app()->createUrl('/Dashboard/default/month'); ?>">
                View more <i class="m-icon-swapright m-icon-white"></i>
            </a>
        </div>
    </div>
    <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
        <div class="dashboard-stat yellow">
            <div class="visual">
                <i class="icon-bar-chart"></i>
            </div>
            <div class="details">
                <div class="number">
                    <table class='view_em'>
                        <tr><th>Sự kiện mới</th><td><?php echo $num_event_day ?></td></tr>
                        <tr><th>THành viên mới</th><td><?php echo $num_member_day; ?></td></tr>
                    </table> 
                </div>
                <div class="desc">New Members</div>
            </div>
            <a class="more" href="<?php echo Yii::app()->createUrl('/Dashboard/default/member'); ?>">
                View more <i class="m-icon-swapright m-icon-white"></i>
            </a>
        </div>
    </div>
</div>
<!-- END DASHBOARD STATS -->
<div class="clearfix"></div>
<div class="row">
    <form name="appForm" method="POST" action="">
        <div class="col-md-3"><?php echo $keywords ?></div>       
        <div class="col-md-1"><?php echo $buttonSearch ?></div>
        <div class="col-md-1"><?php echo $buttonReset ?></div>
        <div class="col-md-7"></div>
    </form>
</div>
<div class="row">    
    <div class="col-md-12"><p></p></div>                            
</div>
<div class="row">
    <div class="col-md-12">
        <table class="table table-striped table-bordered table-advance table-hover">
            <thead>
                <tr>
                    <th id="slide-grid_c0">#</th>
                    <th id="slide-grid_c1">Title</th>
                    <th id="slide-grid_c2">Create date</th>
                    <th id="slide-grid_c3">Start date</th>
                    <th id="slide-grid_c4">Email</th>
                    <th id="slide-grid_c5">Address</th>
                </tr>
            </thead>  
            <tbody>
                <?php
                foreach ($item_em as $key => $value) {
                    $title = CHtml::encode($value['title']);
                    $create_date = CHtml::encode($value['posteddate']);
                    $start_date = CHtml::encode($value['startdate']);
                    $end_date = CHtml::encode($value['enddate']);
                    $email = CHtml::encode($value->members['email']);
                    $address = CHtml::encode($value->members['address']);
                    $link = "#";
                    ?>
                    <tr>
                        <td><?php echo $key + 1 ?></td> 
                        <td><a href=<?php echo $link ?>><?php echo $title ?></a></td> 
                        <td><?php echo $start_date ?></td>
                        <td><?php echo $end_date ?></td>
                        <td><?php echo $email ?></td>
                        <td><?php echo $address ?></td>
                    </tr>

                <?php } ?>
            </tbody>
        </table>
    </div>      
</div>
<div class="row">
    <div class="col-md-12">
        <div class="pager">
            <?php $this->widget('CLinkPager', array( 'htmlOptions'=>array('class'=>'pagination pagination-sm',), 
                                                     'pages' => $pages, 
                                                     'cssFile' => FALSE,
                                                     'header'=>FALSE,
                                                    )
                                );
            ?>
        </div>    
    </div>
</div>
<div class="clearfix"></div>